package com.atguigu.day07.test;

/**
 * @version 1.0
 * @Author 马冰
 * @Date 2024/11/6 16:34
 * @注释
 */
public class Rectaangle {
    double length;
    double width;
    public void perimeter(){
        double perimeter = (length + width) * 2;
        System.out.println("矩形的周长是：" + perimeter);
    }
    public void area(){
        double area = length * width;
        System.out.println("矩形的面积是：" + area);
    }
    public void getInfo(){
        System.out.println("长：" + length);
        System.out.println("宽：" + width);
        perimeter();
        area();
    }
}

class ReTest{
    public static void main(String[] args) {
        Rectaangle r = new Rectaangle();
        Rectaangle r1 = new Rectaangle();
        r.length = 10;
        r.width = 20;
        r.perimeter();
        r.area();
        r.getInfo();
        System.out.println("---------------------");
        r1.length = 12.2;
        r1.width = 15.3;
        r1.perimeter();
        r1.area();
        r1.getInfo();
    }
}
